<?php

class AccountController extends Zend_Controller_Action {

    public function init() {
        /* Initialize action controller here */
        $this->view->headTitle = "Account";
    }

    public function indexAction() {
        // action body
        $this->view->headTitle = "Middledman";
    }

    public function signAction() {
        $request = $this->getRequest();
        $form = new Application_Form_Login();

        if ($this->getRequest()->isPost()) {
            if ($form->isValid($request->getPost())) {
//                $comment = new Application_Model_Guestbook($form->getValues());
//                $mapper = new Application_Model_GuestbookMapper();
//                $mapper->save($comment);
                return $this->_helper->redirector('index/index');
            }
            $this->_redirect('index/index');
        }

        $this->view->form = $form;
    }
    public function loginAction() {
        $form = new Application_Model_FormLogin();
        $this->view->form = $form;
        $this->view->headTitle = "Middledman";

        if (isset($_POST)) {
            if ($form->isValid($this->_request->getPost())) {
                echo "<p>VALID INPUT!</p>";
                print_r($_POST);
            }
        }
    }
    

    public function viewAction() {
        $game = new Application_Model_DbTable_Game();
        $this->view->game = $game->find(1)->current();
    }

}

